﻿using FluentValidation.Attributes;
using Nop.Admin.Models.Common;
using Nop.Admin.Validators.XJ;
using Nop.Web.Framework.Mvc;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Web.Mvc;

namespace Nop.Admin.Models.XJ
{
	public class EquipmentListModel
	{
		public EquipmentListModel()
		{
			AvailableTypes = new List<SelectListItem>();
			AvailableCategories = new List<SelectMenuModel>();
			AvailablePlaces = new List<SelectListItem>();
			AvailableDepartments = new List<SelectListItem>();
		}
		public int SearchCategoryMainId { get; set; }
		/// <summary>
		/// 巡检点
		/// </summary>
		public int SearchPlaceId { get; set; }
		[UIHint("SelectMenu")]
		public int SearchCategoryId { get; set; }
		public int SearchPId { get; set; }
		public string SearchName { get; set; }
		/// <summary>
		/// 品牌
		/// </summary>
		public string SearchManufacturer { get; set; }
		/// <summary>
		/// 规格型号
		/// </summary>
		public string SearchSpecification { get; set; }
		public int PlanId { get; set; }
		public int StockInId { get; set; }
		public int StockOutId { get; set; }
		public int MaintenanceId { get; set; }
		/// <summary>
		/// 只显示有库存
		/// </summary>
		public bool OnlyStock { get; set; }
		/// <summary>
		/// 只显示库存预警
		/// </summary>
		public bool OnlyWarn { get; set; }
		public int[] SelectedProductIds { get; set; }
		/// <summary>
		/// 类型
		/// </summary>
		public IList<SelectListItem> AvailableTypes { get; set; }
		/// <summary>
		/// 分类
		/// </summary>
		public IList<SelectMenuModel> AvailableCategories { get; set; }
		/// <summary>
		/// 巡检点
		/// </summary>
		public IList<SelectListItem> AvailablePlaces { get; set; }
		/// <summary>
		/// 部门
		/// </summary>
		public IList<SelectListItem> AvailableDepartments { get; set; }
	}

	[Validator(typeof(EquipmentValidator))]
	public class EquipmentModel : BaseNopEntityModel
	{
		public EquipmentModel()
		{
			PlaceIds = new List<int>();
			AvailableTypes = new List<SelectListItem>();
			AvailableCategories = new List<SelectMenuModel>();
			AvailableEquipments = new List<SelectListItem>();
			AvailablePlaces = new List<SelectListItem>();
			AvailableDepartments = new List<SelectListItem>();
		}
		/// <summary>
		/// 巡检点
		/// </summary>
		[UIHint("MultiSelect")]
		public IList<int> PlaceIds { get; set; }
		public string PlaceNames { get; set; }
		/// <summary>
		/// 主分类：设施设备、配件
		/// <see cref="CategoryMainEnum"/>
		/// </summary>
		public int CategoryMainId { get; set; }
		public string CategoryMainName { get; set; }
		/// <summary>
		/// 分类
		/// <see cref="XJEquipmentCategory"/>
		/// </summary>
		[UIHint("SelectMenu")]
		public int CategoryId { get; set; }
		public string CategoryName { get; set; }
		/// <summary>
		/// 父ID
		/// </summary>
		public int PId { get; set; }
		/// <summary>
		/// 名称
		/// </summary>
		public string Name { get; set; }
		/// <summary>
		/// 单价
		/// </summary>
		public decimal Price { get; set; }
		/// <summary>
		/// 平均使用寿命
		/// </summary>
		public int MeanLife { get; set; }
		/// <summary>
		/// 品牌
		/// </summary>
		public string Manufacturer { get; set; }
		/// <summary>
		/// 规格型号
		/// </summary>
		public string Specification { get; set; }
		/// <summary>
		/// 单位
		/// </summary>
		public string Unit { get; set; }
		/// <summary>
		/// 排序
		/// </summary>
		public int DisplayOrder { get; set; }
		/// <summary>
		/// 最小库存数量
		/// </summary>
		public int StockMin { get; set; }
		/// <summary>
		/// 当前库存数量
		/// </summary>
		public int Stock { get; set; }
		/// <summary>
		/// 冻结数量
		/// </summary>
		public int Freeze { get; set; }
		/// <summary>
		/// 发布
		/// </summary>
		public bool Published { get; set; }
		/// <summary>
		/// 选中
		/// </summary>
		public bool Checked { get; set; }
		/// <summary>
		/// 创建人
		/// </summary>
		public int CustomerId { get; set; }
		/// <summary>
		/// 创建时间
		/// </summary>
		public DateTime CreatedOn { get; set; }

		public string Breadcrumb { get; set; }
		/// <summary>
		/// 类型
		/// </summary>
		public IList<SelectListItem> AvailableTypes { get; set; }
		/// <summary>
		/// 分类
		/// </summary>
		public IList<SelectMenuModel> AvailableCategories { get; set; }
		/// <summary>
		/// 设施设备
		/// </summary>
		public IList<SelectListItem> AvailableEquipments { get; set; }
		/// <summary>
		/// 巡检点
		/// </summary>
		public IList<SelectListItem> AvailablePlaces { get; set; }
		/// <summary>
		/// 部门
		/// </summary>
		public IList<SelectListItem> AvailableDepartments { get; set; }
	}
}